package com.vcc.core.derive.converter.rechargeLog;

import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;

/**
 * 充值订单事件转换器
 */
public class UseFlagConverter implements Converter<Integer> {

    private static String useFlagToString(Integer useFlag) {
//        0 虚拟币入金  1 充值补单  2 对公打款
        return switch (useFlag) {
            case 0 -> "加密充值";
            case 1 -> "充值补单";
            default -> "对公打款";
        };
    }

    @Override
    public Class<Integer> supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }


    @Override
    public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }


    @Override
    public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(useFlagToString(value));
    }
}